********************************************************************************
**  TITLE:      us2000_naes_contact_networks                                  **  
**  AUTHOR:	    Philippe Mongrain                                             **
**  DATA:       NAES 2000 Nat CS 19991214-20000403 Data,                      **
**              NAES 2000 Nat CS 20000404-20000717 Data,                      **
**              NAES 2000 Nat CS 20000718-20000904 Data,                      **
**              NAES 2000 Nat CS 20000905-20001002 Data,                      **
**              NAES 2000 Nat CS 20001003-20001106 Data                       **
**  DATE:	    October 2022 						                          **	
**  VERSION:	Stata 16					                                  **	
********************************************************************************

* Version control

version 16.0

* Open log file

capture log close       			  			              
log using "us2000_naes_contact_networks", replace

* Open the dataset

import spss using "NAES 2000 Nat CS 19991214-20000403 Data.sav", clear case(lower)

gen study = 1

keep study ckey cdate ca01 ca11 ca21 ca30 ca39 cw01 cw02 cw06 ck02 ck03 ck04 ck05 ck07 ck09 ck11 cv01 cv02 cv03 ce01 ce02 ce03 ce06 ce07 ce13 ce15 cn01 cn02 cn03 cn04 cn05 cn06 cn07 cr06 cr11 cr12

save "NAES_2000_1214_0403.dta", replace

import spss using "NAES 2000 Nat CS 20000404-20000717 Data.sav", clear case(lower)

gen study = 2

keep study ckey cdate ca01 ca11 ca21 ca30 ca39 cw01 cw02 cw06 ck01 ck02 ck03 ck04 ck05 ck07 ck09 ck11 cv01 cv02 cv03 ce01 ce02 ce03 ce06 ce07 ce13 ce15 cn01 cn02 cn03 cn04 cn05 cn06 cn07 cr06 cr11 cr12

save "NAES_2000_0404_0717.dta", replace

import spss using "NAES 2000 Nat CS 20000718-20000904 Data.sav", clear case(lower)

gen study = 3

keep study ckey cdate ca01 ca11 ca21 ca30 ca39 cw01 cw02 cw06 ck01 ck02 ck03 ck04 ck05 ck07 ck09 ck11 cv01 cv02 cv03 ce01 ce02 ce03 ce06 ce07 ce13 ce15 cn01 cn02 cn03 cn04 cn05 cn06 cn07 cr06 cr11 cr12

save "NAES_2000_0718_0904.dta", replace

import spss using "NAES 2000 Nat CS 20000905-20001002 Data.sav", clear case(lower)

gen study = 4

keep study ckey cdate ca01 ca11 ca21 ca30 ca39 cw01 cw02 cw06 ck01 ck02 ck03 ck04 ck05 ck07 ck09 ck11 cv01 cv02 cv03 ce01 ce02 ce03 ce06 ce07 ce13 ce15 cn01 cn02 cn03 cn04 cn05 cn06 cn07 cr06 cr11 cr12

save "NAES_2000_0905_1002.dta", replace

import spss using "NAES 2000 Nat CS 20001003-20001106 Data.sav", clear case(lower)

gen study = 5

keep study ckey cdate ca01 ca11 ca21 ca30 ca39 cw01 cw02 cw06 ck01 ck02 ck03 ck04 ck05 ck07 ck09 ck11 cv01 cv02 cv03 ce01 ce02 ce03 ce06 ce07 ce13 ce15 cn01 cn02 cn03 cn04 cn05 cn06 cn07 cr06 cr11 cr12

save "NAES_2000_1003_1106.dta", replace

use "NAES_2000_1214_0403.dta", clear

append using "NAES_2000_0404_0717.dta"
append using "NAES_2000_0718_0904.dta"
append using "NAES_2000_0905_1002.dta"
append using "NAES_2000_1003_1106.dta"


***************************
** INDEPENDENT VARIABLES **
***************************

* Time (presidential election)

gen surveydate=date(string(cdate,"%8.0f"),"YMD")

format %tdMon_DD,_CCYY surveydate

gen edate = 20001107

gen electiondate=date(string(edate,"%8.0f"),"YMD")

format %tdMon_DD,_CCYY electiondate

gen time = (electiondate - surveydate) - 1 // Substract 1 to correct for election date

* Time (Democratic primary election)

gen ddate = 20000817

gen demdate=date(string(ddate,"%8.0f"),"YMD")

format %tdMon_DD,_CCYY demdate

gen dtime = (demdate - surveydate) - 1 // Substract 1 to correct for election date

* Time (Republican primary election)

gen rdate = 20000803

gen repdate=date(string(rdate,"%8.0f"),"YMD")

format %tdMon_DD,_CCYY repdate

gen rtime = (repdate - surveydate) - 1 // Substract 1 to correct for election date

* Gender

gen male = cw01

recode male (2=0)

* Age

gen age = cw02

recode age (998=.)
recode age (999=.)

replace age = . if age < 17

* Education

gen education = cw06

recode education (998=.)
recode education (999=.)

* Interest for election

gen interestgovt = ck01
gen interestcampaigns = ck02
gen interestelection = ck03

recode interestgovt (998=.)
recode interestgovt (999=.)
recode interestgovt (4=3)

recode interestcampaigns (998=.)
recode interestcampaigns (999=.)

recode interestelection (998=.)
recode interestelection (999=.)

gen interest_president = .

replace interest_president = interestgovt
replace interest_president = interestcampaigns if interestcampaigns!=.
replace interest_president = interestelection if interestelection!=.

replace interest_president = 4 - interest_president

gen interest_primaries = .

replace interest_primaries = interestgovt
replace interest_primaries = interestcampaigns if interestcampaigns!=.

replace interest_primaries = 4 - interest_primaries

* Caring about outcome (national)

gen care_whole = ck04

recode care_whole (998=.)
recode care_whole (999=.)
recode care_whole (2=0)

* Party identification

gen pidstatus_whole = cv01

recode pidstatus_whole (4=3)
recode pidstatus_whole (998=.)
recode pidstatus_whole (999=.)

replace pidstatus_whole = 30 if pidstatus_whole == 1
replace pidstatus_whole = 20 if pidstatus_whole == 3
replace pidstatus_whole = 10 if pidstatus_whole == 2

replace pidstatus_whole = 1 if pidstatus_whole == 10
replace pidstatus_whole = 2 if pidstatus_whole == 20
replace pidstatus_whole = 3 if pidstatus_whole == 30

label define pidstatus 1 "Loser PID" 2 "No PID/Other" 3 "Winner PID" 
label values pidstatus_whole pidstatus

* Party identification scale

gen pidscale_whole = .

replace pidscale_whole = 1 if pidstatus_whole == 1 & cv02 == 1
replace pidscale_whole = 2 if pidstatus_whole == 1 & cv02 == 2
replace pidscale_whole = 3 if cv03 == 2
replace pidscale_whole = 4 if pidstatus_whole == 2 & cv03 == 3 | pidstatus_whole == 2 & cv03 == 998
replace pidscale_whole = 5 if cv03 == 1
replace pidscale_whole = 6 if pidstatus_whole == 3 & cv02 == 2
replace pidscale_whole = 7 if pidstatus_whole == 3 & cv02 == 1

label define pidscale 1 "Strong loser PID" 2 "Moderate loser PID" 3 "Weak loser PID" 4 "No PID/Other" 5 "Weak winner PID" 6 "Moderate winner PID" 7 "Strong winner PID" 
label values pidscale_whole pidscale

* Evaluation of Bush

gen bushrating = ca01

recode bushrating (101=.)
recode bushrating (102=.)
recode bushrating (999=.)

* Evaluation of McCain

gen mccainrating = ca21

recode mccainrating (101=.)
recode mccainrating (102=.)
recode mccainrating (999=.)

* Evaluation of Forbes

gen forbesrating = ca39

recode forbesrating (101=.)
recode forbesrating (102=.)
recode forbesrating (999=.)

* Republican primary preference

gen repprefA = bushrating 
gen repprefB = mccainrating  
gen repprefC = forbesrating 

gen reppref_complete = 1 if repprefA!=. & repprefB!=. & repprefC!=.

gen reppreference = 3 if repprefA >= repprefB & repprefA >= repprefC & reppref_complete == 1
replace reppreference = 2 if repprefA == repprefB & repprefA == repprefC & reppref_complete == 1
replace reppreference = 1 if reppreference!=2 & reppreference!=3 & reppref_complete == 1

replace reppreference = . if reppreference == 3 & repprefA == repprefB & reppref_complete == 1
replace reppreference = . if reppreference == 3 & repprefA == repprefC & reppref_complete == 1

label define reppreference 1 "Loser Republican preference" 2 "No preference" 3 "Winner Republican preference"
label values reppreference reppreference

* Evaluation of Gore

gen gorerating = ca11

recode gorerating (101=.)
recode gorerating (102=.)
recode gorerating (999=.)

* Evaluation of Bradley

gen bradleyrating = ca30

recode bradleyrating (101=.)
recode bradleyrating (102=.)
recode bradleyrating (999=.)

* Democratic primary preference

gen demprefA = gorerating 
gen demprefB = bradleyrating  

gen dempref_complete = 1 if demprefA!=. & demprefB!=.

gen dempreference = 3 if demprefA >= demprefB & dempref_complete == 1
replace dempreference = 2 if demprefA == demprefB & dempref_complete == 1
replace dempreference = 1 if dempreference!=2 & dempreference!=3 & dempref_complete == 1

replace dempreference = . if dempreference == 3 & demprefA == demprefB

label define dempreference 1 "Loser Democratic preference" 2 "No preference" 3 "Winner Democratic preference"
label values dempreference dempreference

* Republican primary vote

gen rep_vote = .

replace rep_vote = 1 if cr11 == 2
replace rep_vote = 0 if cr11!=2 & cr11!=. 
replace rep_vote = . if cr11 == 8 | cr11 == 998 | cr11 == 999

* Democratic primary vote

gen dem_vote = .

replace dem_vote = 1 if cr12 == 2
replace dem_vote = 0 if cr12!=2 & cr12!=. 
replace dem_vote = . if cr12 == 4 | cr12 == 998 | cr12 == 999

* National TV news attentiveness

gen nattv = ce03

recode nattv (998=.)
recode nattv (999=.)

replace nattv = 5 - nattv

recode nattv (.=-99)

* Local TV news attentiveness

gen loctv = ce07

recode loctv (998=.)
recode loctv (999=.)

replace loctv = 5 - loctv

recode loctv (.=-99)

* Press news attentiveness

gen press = ce15

recode press (998=.)
recode press (999=.)

replace press = 5 - press

recode press (.=-99)

* News attentiveness index

egen news = rowmax(nattv loctv press)

recode news (-99=.)

* Thought about presidential primary

gen primattention = cr06

recode primattention (2=0)
recode primattention (998=0)
recode primattention (999=.)

* Political discussion

gen discussion_family_friends = ck05

recode discussion_family_friends (998=.)
recode discussion_family_friends (999=.)

gen discussion_work_online = ck09

recode discussion_work_online (998=.)
recode discussion_work_online (999=.)

gen discussion = discussion_family_friends + discussion_work_online

gen discussion_family_friends_3pts = 0 if discussion_family_friends < 2 & discussion_family_friends!=.
replace discussion_family_friends_3pts = 1 if discussion_family_friends >= 2 & discussion_family_friends < 4 & discussion_family_friends!=.
replace discussion_family_friends_3pts = 2 if discussion_family_friends >= 4 & discussion_family_friends!=.

gen discussion_work_online_3pts = 0 if discussion_work_online < 2 & discussion_work_online!=.
replace discussion_work_online_3pts = 1 if discussion_work_online >= 2 & discussion_work_online < 4 & discussion_work_online!=.
replace discussion_work_online_3pts = 2 if discussion_work_online >= 4 & discussion_work_online!=.

egen discussion_3pts = rowmax(discussion_family_friends_3pts discussion_work_online_3pts)

* Political disagreement

gen disagreement_family_friends = ck07

recode disagreement_family_friends (998=.)
recode disagreement_family_friends (999=.)

replace disagreement_family_friends = 5 - disagreement_family_friends

replace disagreement_family_friends = 0 if discussion_family_friends == 0

gen disagreement_work_online = ck11

recode disagreement_work_online (998=.)
recode disagreement_work_online (999=.)

replace disagreement_work_online = 5 - disagreement_work_online

replace disagreement_work_online = 0 if discussion_work_online == 0

gen disagreement = disagreement_family_friends + disagreement_work_online

gen disagreement_family_friends_3pts = disagreement_family_friends
replace disagreement_family_friends_3pts = 0 if disagreement_family_friends == 1
replace disagreement_family_friends_3pts = 1 if disagreement_family_friends == 2
replace disagreement_family_friends_3pts = 2 if disagreement_family_friends == 3
replace disagreement_family_friends_3pts = 2 if disagreement_family_friends == 4

gen disagreement_work_online_3pts = disagreement_work_online
replace disagreement_work_online_3pts = 0 if disagreement_work_online == 1
replace disagreement_work_online_3pts = 1 if disagreement_work_online == 2
replace disagreement_work_online_3pts = 2 if disagreement_work_online == 3
replace disagreement_work_online_3pts = 2 if disagreement_work_online == 4

egen disagreement_3pts = rowmax(disagreement_family_friends_3pts disagreement_work_online_3pts)


***************************************
** REPUBLICAN PRIMARIES EXPECTATIONS **
***************************************

* Generate variable identifying incomplete answers

gen bushprimaries = cn01
gen mccainprimaries = cn02
gen forbesprimaries = cn03

gen complete_repprimaries_1 = 1 if bushprimaries!=. & mccainprimaries!=. & forbesprimaries!=. & electiondate <= date("20000112","YMD")
gen complete_repprimaries_2 = 1 if bushprimaries!=. & mccainprimaries!=. & electiondate > date("20000112","YMD")

* Generate value of 1 if the expectation for one candidate is higher or equal to the expectations for at least one other candidate

gen repprimariesA = 1 if bushprimaries >= mccainprimaries & bushprimaries >= forbesprimaries & complete_repprimaries_1 == 1
gen repprimariesB = 1 if mccainprimaries >= bushprimaries & mccainprimaries >= mccainprimaries & complete_repprimaries_1 == 1
gen repprimariesC = 1 if forbesprimaries >= bushprimaries & forbesprimaries >= mccainprimaries & complete_repprimaries_1 == 1
gen repprimariesOTH = 1 if bushprimaries == 0 & mccainprimaries == 0 & forbesprimaries == 0 & complete_repprimaries_1 == 1

replace repprimariesA = . if repprimariesOTH == 1 & complete_repprimaries_1 == 1
replace repprimariesB = . if repprimariesOTH == 1 & complete_repprimaries_1 == 1
replace repprimariesC = . if repprimariesOTH == 1 & complete_repprimaries_1 == 1

replace repprimariesA = 1 if bushprimaries >= mccainprimaries & complete_repprimaries_2 == 1
replace repprimariesB = 1 if mccainprimaries >= bushprimaries & complete_repprimaries_2 == 1
replace repprimariesOTH = 1 if bushprimaries == 0 & mccainprimaries == 0 & complete_repprimaries_2 == 1

replace repprimariesA = . if repprimariesOTH == 1 & complete_repprimaries_2 == 1
replace repprimariesB = . if repprimariesOTH == 1 & complete_repprimaries_2 == 1

* Generate variable for ambiguous forecasts

gen ambiguous_repprimaries = .

replace ambiguous_repprimaries = 99 if repprimariesA == repprimariesB & repprimariesA!=. | repprimariesA == repprimariesC & repprimariesA!=.
replace ambiguous_repprimaries = 99 if repprimariesB == repprimariesA & repprimariesB!=. | repprimariesB == repprimariesC & repprimariesB!=.
replace ambiguous_repprimaries = 99 if repprimariesC == repprimariesA & repprimariesC!=. | repprimariesC == repprimariesB & repprimariesC!=.

* Generate value of 0 for lower expectations

replace repprimariesA = 0 if repprimariesA!=1 & repprimariesA!=. & complete_repprimaries_1 == 1
replace repprimariesB = 0 if repprimariesB!=1 & repprimariesB!=. & complete_repprimaries_1 == 1
replace repprimariesC = 0 if repprimariesC!=1 & repprimariesC!=. & complete_repprimaries_1 == 1
replace repprimariesOTH = 0 if repprimariesOTH!=1 & repprimariesOTH!=. & complete_repprimaries_1 == 1

replace repprimariesA = 0 if repprimariesA!=1 & repprimariesA!=. & complete_repprimaries_2 == 1
replace repprimariesB = 0 if repprimariesB!=1 & repprimariesB!=. & complete_repprimaries_2 == 1
replace repprimariesOTH = 0 if repprimariesOTH!=1 & repprimariesOTH!=. & complete_repprimaries_2 == 1

* Forecasts (1 = Bush, 2 = McCain, 3 = Forbes, 88 = other, 99 = ambiguous)

gen forecast_repprimaries = .

replace forecast_repprimaries = 1 if repprimariesA == 1 & complete_repprimaries_1 == 1
replace forecast_repprimaries = 2 if repprimariesB == 1 & complete_repprimaries_1 == 1
replace forecast_repprimaries = 3 if repprimariesC == 1 & complete_repprimaries_1 == 1
replace forecast_repprimaries = 88 if repprimariesOTH == 1 & complete_repprimaries_1 == 1
replace forecast_repprimaries = 99 if ambiguous_repprimaries == 1 & complete_repprimaries_1 == 1

replace forecast_repprimaries = 1 if repprimariesA == 1 & complete_repprimaries_2 == 1
replace forecast_repprimaries = 2 if repprimariesB == 1 & complete_repprimaries_2 == 1
replace forecast_repprimaries = 88 if repprimariesOTH == 1 & complete_repprimaries_2 == 1
replace forecast_repprimaries = 99 if ambiguous_repprimaries == 1 & complete_repprimaries_2 == 1

* Identify correct and ambiguous forecasts

gen correct_repprimaries = 0 if forecast_repprimaries!=1 & forecast_repprimaries!=. & complete_repprimaries_1 == 1
replace correct_repprimaries = 1 if forecast_repprimaries == 1 & complete_repprimaries_1 == 1

replace correct_repprimaries = 0 if forecast_repprimaries!=1 & forecast_repprimaries!=. & complete_repprimaries_2 == 1
replace correct_repprimaries = 1 if forecast_repprimaries == 1 & complete_repprimaries_2 == 1

replace correct_repprimaries = 99 if forecast_repprimaries == 99 & repprimariesA == 1 & complete_repprimaries_1 == 1

replace correct_repprimaries = 99 if forecast_repprimaries == 99 & repprimariesA == 1 & complete_repprimaries_2 == 1

* Generate dichotomous variable (treat ambiguous forecasts as incorrect)

gen correct_repprimaries_d = correct_repprimaries

replace correct_repprimaries_d = 0 if correct_repprimaries_d == 99
replace correct_repprimaries_d = 1 if correct_repprimaries_d == 1


***************************************
** DEMOCRATIC PRIMARIES EXPECTATIONS **
***************************************

* Generate variable identifying incomplete answers

gen goreprimaries = cn04
gen bradleyprimaries = cn05

recode goreprimaries (998=.)
recode goreprimaries (999=.)

recode bradleyprimaries (998=.)
recode bradleyprimaries (999=.)

gen forecast_demprimaries = 1 if goreprimaries > 50 & goreprimaries!=.
replace forecast_demprimaries = 1 if bradleyprimaries < 50 & bradleyprimaries!=.
replace forecast_demprimaries = 2 if goreprimaries < 50 & goreprimaries!=.
replace forecast_demprimaries = 2 if bradleyprimaries > 50 & bradleyprimaries!=.
replace forecast_demprimaries = 99 if goreprimaries == 50 & goreprimaries!=.
replace forecast_demprimaries = 99 if bradleyprimaries == 50 & bradleyprimaries!=.
replace forecast_demprimaries = 99 if cn04 == 998
replace forecast_demprimaries = 99 if cn05 == 998

* Identify correct forecasts

gen correct_demprimaries_d = 0 if forecast_demprimaries!=1 & forecast_demprimaries!=.
replace correct_demprimaries_d = 1 if forecast_demprimaries == 1


*********************************
** NATIONAL-LEVEL EXPECTATIONS **
*********************************

* Forecasts

gen bushchances = cn06
gen gorechances = cn07

recode bushchances (998=.)
recode bushchances (999=.)

recode gorechances (998=.)
recode gorechances (999=.)

gen forecast_whole = 1 if bushchances > 50 & bushchances!=.
replace forecast_whole = 1 if gorechances < 50 & gorechances!=.
replace forecast_whole = 2 if bushchances < 50 & bushchances!=.
replace forecast_whole = 2 if gorechances > 50 & gorechances!=.
replace forecast_whole = 99 if bushchances == 50 & bushchances!=.
replace forecast_whole = 99 if gorechances == 50 & gorechances!=.
replace forecast_whole = 99 if cn06 == 998
replace forecast_whole = 99 if cn07 == 998

* Identify correct forecasts

gen correct_whole_d = 0 if forecast_whole!=1 & forecast_whole!=.
replace correct_whole_d = 1 if forecast_whole == 1


**********
** SAVE **
**********

save "us2000_naes.dta", replace


*****************************************
** MAIN ANALYSES: REPUBLICAN PRIMARIES **
*****************************************

* Regression analysis and percentage of correct and incorrect forecasts (Republican primaries)

logistic correct_repprimaries_d discussion disagreement bushrating interest_primaries news i.primattention age i.male education rtime
estimates table, star(.05 .01 .001)

tab correct_repprimaries_d if e(sample) == 1


***********************************************
** SUMMARY STATISTICS: REPUBLICAN PRIMARIES **
***********************************************

label variable correct_whole_d "Presidency winner (DV)"
label variable correct_repprimaries_d "Republican nominee (DV)"
label variable correct_demprimaries_d "Democratic nominee (DV)"
label variable discussion "Discussion"
label variable disagreement "Disagreement"
label variable pidscale_whole "National PID"
label variable bushrating "Bush rating"
label variable gorerating "Gore rating"
label variable interest_president "Interest"
label variable interest_primaries "Interest"
label variable news "News attentiveness"
label variable primattention "Attention to primary"
label variable care_whole "Caring about outcome"
label variable age "Age"
label variable male "Gender (male = 1)"
label variable education "Education"
label variable rtime "Time of interview"

estpost tabstat correct_repprimaries_d discussion disagreement bushrating interest_primaries news primattention age male education rtime if e(sample) == 1, statistics(n mean p50 sd min max) columns(statistics)

esttab using "us2000_naes_summary_repprimaries.tex", substitute("\begin{table}[htbp]" "\begin{table}[H]") cells("count(label(N) fmt(%9.0fc)) mean(fmt(%5.2f) label(Mean)) p50(fmt(%5.1f) label(Median)) sd(fmt(%5.1f) label(Std. dev.)) min(fmt(%5.1f) label(Min)) max(fmt(%5.1f) label(Max))") label width(\textwidth) nomtitle nonumber noobs booktabs title("Summary statistics -- 2000 Republican presidential primaries (NAES), national level") replace

eststo clear


*****************************************
** MAIN ANALYSES: DEMOCRATIC PRIMARIES **
*****************************************

* Regression analysis and percentage of correct and incorrect forecasts (Democratic primaries)

logistic correct_demprimaries_d discussion disagreement gorerating interest_primaries news i.primattention age i.male education dtime
estimates table, star(.05 .01 .001)

tab correct_demprimaries_d if e(sample) == 1


**********************************************
** SUMMARY STATISTICS: DEMOCRATIC PRIMARIES **
**********************************************

label variable correct_whole_d "Presidency winner (DV)"
label variable correct_repprimaries_d "Republican nominee (DV)"
label variable correct_demprimaries_d "Democratic nominee (DV)"
label variable discussion "Discussion"
label variable disagreement "Disagreement"
label variable pidscale_whole "National PID"
label variable bushrating "Bush rating"
label variable gorerating "Gore rating"
label variable interest_president "Interest"
label variable interest_primaries "Interest"
label variable news "News attentiveness"
label variable primattention "Attention to primary"
label variable care_whole "Caring about outcome"
label variable age "Age"
label variable male "Gender (male = 1)"
label variable education "Education"
label variable dtime "Time of interview"

estpost tabstat correct_demprimaries_d discussion disagreement gorerating interest_primaries news primattention age male education dtime if e(sample) == 1, statistics(n mean p50 sd min max) columns(statistics)

esttab using "us2000_naes_summary_demprimaries.tex", substitute("\begin{table}[htbp]" "\begin{table}[H]") cells("count(label(N) fmt(%9.0fc)) mean(fmt(%5.2f) label(Mean)) p50(fmt(%5.1f) label(Median)) sd(fmt(%5.1f) label(Std. dev.)) min(fmt(%5.1f) label(Min)) max(fmt(%5.1f) label(Max))") label width(\textwidth) nomtitle nonumber noobs booktabs title("Summary statistics -- 2000 Democratic presidential primaries (NAES), national level") replace

eststo clear


******************************************
** MAIN ANALYSES: PRESIDENTIAL ELECTION **
******************************************

* Regression analysis and percentage of correct and incorrect forecasts (national)

logistic correct_whole_d discussion disagreement pidscale_whole interest_president news i.care_whole age i.male education time
estimates table, star(.05 .01 .001)

tab correct_whole_d if e(sample) == 1


***********************************************
** SUMMARY STATISTICS: PRESIDENTIAL ELECTION **
***********************************************

label variable correct_whole_d "Presidency winner (DV)"
label variable correct_repprimaries_d "Republican nominee (DV)"
label variable correct_demprimaries_d "Democratic nominee (DV)"
label variable discussion "Discussion"
label variable disagreement "Disagreement"
label variable pidscale_whole "National PID"
label variable bushrating "Bush rating"
label variable gorerating "Gore rating"
label variable interest_president "Interest"
label variable interest_primaries "Interest"
label variable news "News attentiveness"
label variable primattention "Attention to primary"
label variable care_whole "Caring about outcome"
label variable age "Age"
label variable male "Gender (male = 1)"
label variable education "Education"
label variable time "Time of interview"

estpost tabstat correct_whole_d discussion disagreement pidscale_whole interest_president news care_whole age male education time if e(sample) == 1, statistics(n mean p50 sd min max) columns(statistics)

esttab using "us2000_naes_summary_national.tex", substitute("\begin{table}[htbp]" "\begin{table}[H]") cells("count(label(N) fmt(%9.0fc)) mean(fmt(%5.2f) label(Mean)) p50(fmt(%5.1f) label(Median)) sd(fmt(%5.1f) label(Std. dev.)) min(fmt(%5.1f) label(Min)) max(fmt(%5.1f) label(Max))") label width(\textwidth) nomtitle nonumber noobs booktabs title("Summary statistics -- 2000 American presidential election (NAES), national level") replace

eststo clear

log close